﻿using System;

namespace Aeon.Framework.Objects.Models
{

/// <summary>
/// Animation objects wrapper class.
/// 
/// </summary>
public class Animation<T> : Model<T>, IPlay where T : IParserModel, new()
    {
    // --- Attributes:

    private IPlayAdapter animation;    // Model object.

    // --- Constructor:

    public Animation(String key, Position origin, Orientation angle, AeonMaterial material, String file)
        : base(key,origin,angle,material,file)
        {
        if (model is IPlayAdapter) animation = model as IPlayAdapter;
        else throw new Exception(typeof(T).Name+" does not support animated models.");
        }
    
    // --- Public Methods:

    public bool Loop { get { return(animation.Loop); } set { animation.Loop = value; } }
    public float Percent { get { return(animation.Percent); } }

    public void AnimateStop() { animation.AnimateStop(); }
    public void AnimateEnd() { animation.AnimateEnd(); }
    public void AnimatePause() { animation.AnimatePause(); }
    public void AnimateForward() { animation.AnimateForward(); }
    public void AnimateBackward() { animation.AnimateBackward(); }
    public void AnimateLoop() { animation.AnimateLoop(); }

    public override string ToString()
        {
        return(animation.ToString());
        }

    }


}